package cn.qf.shop.service.impl;

import cn.qf.shop.mapper.AssetsMapper;
import cn.qf.shop.pojo.entity.Assets;
import cn.qf.shop.pojo.qo.AssetsQo;
import cn.qf.shop.service.AssetsManagementService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资产管理的业务层实现类
 */
@Service
public class AssetsManagementServiceImpl implements AssetsManagementService {

    @Autowired
    private AssetsMapper assetsMapper;

    /**
     * 查询所有
     *
     * @return
     */
    @Override
    public List<Assets> selectAll() {
        List<Assets> assets = assetsMapper.selectAll();
        return assets;
    }

    /**
     * 根据关键字模糊查询
     *
     * @param assetsQo
     * @return
     */
    @Override
    public List<Assets> selectByKeyWord(AssetsQo assetsQo) {
        List<Assets> assets = assetsMapper.selectByKeyWord(assetsQo);
        return assets;
    }

    /**
     * 添加
     *
     * @param assetsQo
     * @return
     */
    @Override
    public int insertAssets(AssetsQo assetsQo) {
        int i = assetsMapper.insertAssets(assetsQo);
        return i;
    }

    /**
     * 编辑/修改
     *
     * @param assetsQo
     * @return
     */
    @Override
    public int updateByOnclick(AssetsQo assetsQo) {
        int i = assetsMapper.updateByOnclick(assetsQo);
        return i;
    }

    /**
     * 删除一条数据
     *
     * @param assetsQo
     * @return
     */
    @Override
    public int updateByAssetsId(AssetsQo assetsQo) {
        int i = assetsMapper.updateByAssetsId(assetsQo);
        return i;
    }

    /**
     * 批量删除
     *
     * @param assetsIds
     * @return
     */
    @Override
    public int updateByAssetsIds(List<Integer> assetsIds) {
        int i = assetsMapper.updateByAssetsIds(assetsIds);
        return i;
    }
}